package cii_lib_graph.elements;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class CiiInterfaceDirector extends javax.swing.JFrame {

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
		} catch(Exception e) {
			log.error("", e);
		}
	}
	
	private static final Logger log = LoggerFactory
			.getLogger(CiiInterfaceDirector.class);

	private JPanel defaultPanel;
	private JPanel inScrollPane;
	private JButton removeB;
	private JButton selectInt;
	private JSeparator jSeparator1;
	private JScrollPane defScrollP;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				CiiInterfaceDirector inst = new CiiInterfaceDirector();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public CiiInterfaceDirector() {
		super();
		initGUI();
	}
	
	private javax.swing.JFrame rThis() {
		return this;
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				defaultPanel = new JPanel();
				BorderLayout defaultPanelLayout = new BorderLayout();
				defaultPanel.setLayout(defaultPanelLayout);
				getContentPane().add(defaultPanel);
				defaultPanel.setBounds(19, 12, 294, 299);
				defaultPanel.setBorder(BorderFactory.createTitledBorder("Name"));
				{
					defScrollP = new JScrollPane();
					defaultPanel.add(defScrollP, BorderLayout.CENTER);
					{
						inScrollPane = new JPanel();
						defScrollP.setViewportView(inScrollPane);
						inScrollPane.setLayout(null);
						{
							jSeparator1 = new JSeparator();
							inScrollPane.add(jSeparator1);
							jSeparator1.setBounds(10, 23, 262, 7);
						}
						{
							selectInt = new JButton();
							inScrollPane.add(selectInt);
							selectInt.setText("Choose");
							selectInt.setBounds(10, 1, 65, 21);
							selectInt.setMargin(new java.awt.Insets(2, 1, 2, 1));
							selectInt.setToolTipText("Add CII interface");
							selectInt.addActionListener(new ActionListener() {
								public void actionPerformed(ActionEvent evt) { log.info("Command: {}", evt.getActionCommand());
									SelectCIIUnit select = new SelectCIIUnit(rThis(),"Select",true);
									select.setVisible(true);
									log.debug("after choose: "+ select.getInterface().Name());
								}
							});
						}
						{
							removeB = new JButton();
							inScrollPane.add(removeB);
							removeB.setText("Drop");
							removeB.setBounds(81, 1, 65, 21);
							removeB.addActionListener(new ActionListener() {
								public void actionPerformed(ActionEvent evt) { log.info("Command: {}", evt.getActionCommand());
									log.debug("removeB.actionPerformed, event="+evt);
								}
							});
						}
					}
				}
			}
			pack();
			this.setSize(342, 438);
		} catch (Exception e) {
			log.error("", e);
		}
	}

}
